import request from '@/utils/request'

const baseURL = '/api/teacher'

export function getTeacherList({
                               page, pageSize, params = {}, data
                             }) {
  return request({
    url: baseURL + '/list',
    method: 'post',
    params: {
      page, pageSize,
      ...params
    }, data
  })
}

export function getOneTeacher(id) {
  return request({
    url: baseURL + `/${id}`,
    method: 'get'
  })
}

export function addTeacher(data) {
  return request({
    url: baseURL,
    method: 'post',
    data
  })
}

export function updateTeacher(id, data) {
  return request({
    url: baseURL + `/${id}`,
    method: 'put',
    data
  })
}

export function deleteOneTeacher(id) {
  return request({
    url: baseURL + `/${id}`,
    method: 'delete'
  })
}

export function resetTeacherPassword(id) {
  return request({
    url: baseURL + `/resetPassword/${id}`,
    method: 'put'
  })
}
